<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>Title</title>
    <script src="../lib/createjs-2015.11.26.min.js"></script>
    <script src="../lib/exif.min.js"></script>
    <script src="../jpang.min.js"></script>
    <script>
        setTimeout(function () {
            function getScript(url) {
                var imported = document.createElement('script');
                imported.src = url;
                imported.async = true;
                document.head.appendChild(imported);
                imported.onload = function () {
                    console.log('loaded!!!',encodeURI(url));
                    console.log(this);
                };
                imported.onerror  = function () {
                    console.log('error!!!');
                };
            }
            getScript('test_extend.js');
            getScript('test_extend.min.js');
        },1000);

        var sprite = new createjs.Sprite();
        var sprite2 = new createjs.MovieClip();
        sprite2.addChild(sprite);
        sprite2.addEventListener('selectedEvent',function (e) {
            console.log('selectedEvent get!!');
        },true);
        sprite.dispatchEvent('selectedEvent',true);
    </script>
</head>
<body>
<a href="tel:110">报警!</a>
<input type="button" width="200" height="40" value="button2" onclick="click2();"/>
<input type="button" width="200" height="40" value="button3" onclick="click3();"/>
</body>
<script>
    console.log(P.getUrlParam('_ijt'));
    console.log(Jpang.checkTxt.email('dd@qq.com'));
    function click2() {
        // window.location.href = "tel:13533744622";
        Jpang.selectImage(function(t, imageBase64){
            console.log(t);
//            console.log(imageBase64);
            var img = document.createElement('img');
            img.src=imageBase64;
            document.body.appendChild(img);
            // download(imageBase64,'test.png','image/png');
        },this,200);
    }
    function click3() {
        Jpang.actionImg(function (base) {
            console.log(base)
        },600)
    }
    function download(data, filename, type) {
        var file = new Blob([data], {type: type});
        if (window.navigator.msSaveOrOpenBlob) // IE10+
            window.navigator.msSaveOrOpenBlob(file, filename);
        else { // Others
            var a = document.createElement("a"),
                url = URL.createObjectURL(file);
            a.href = url;
            a.download = filename;
            document.body.appendChild(a);
            a.click();
            setTimeout(function() {
                document.body.removeChild(a);
                window.URL.revokeObjectURL(url);
            }, 0);
        }
    }
</script>
</html>